// ////////////////////////////////////////////////////////////////////////////////////////
// NAME: Logview.java 
// AUTHOR: CDT Riley Mckenna 
// LAST MODIFIED: 28 March 2012 
// DESCRIPTION: Contains code for logging information for Nullwall
// LIMITATIONS: 
// CITATIONS: In code
// 
// ////////////////////////////////////////////////////////////////////////////////////////
package prototype.revision;

import java.io.IOException;
import java.util.concurrent.TimeoutException;

import android.os.Bundle;
import android.widget.TextView;
import android.os.Environment;

import com.stericson.RootTools.RootTools;
import com.stericson.RootTools.RootToolsException;

public class LogView extends GenericActivity {
	private FileOperations fo = new FileOperations();
	private TextView tv;

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.logview);
		tv = (TextView) findViewById(R.id.logTextView);
		buildView();

	}

	public void buildView() {

		try {
			RootTools.sendShell("dumpsys usagestats >" + fo.getFile()
					+ "/log.txt", 1000); // dumpsys usagestats
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (RootToolsException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (TimeoutException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		fo.ReadFileTextView("log.txt", tv);

	}
}
